package com.itheima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.pagehelper.Page;
import com.itheima.pojo.Clazz;
import org.apache.ibatis.annotations.*;

import java.time.LocalDate;
@Mapper
public interface ClazzMapper extends BaseMapper<Clazz> {

    Page<Clazz> findAll(@Param("name") String name, @Param("begin") LocalDate begin,@Param("end") LocalDate end);
    //根据id删除
    @Delete("delete from clazz where id = #{id}")
    void deleteClazz(Integer id);

    @Insert("insert into clazz (id , name , room , begin_date , end_date , master_id , subject , create_time , update_time) values " +
            "(#{id} , #{name} ,#{room} , #{beginDate} , #{endDate} , #{masterId} , #{subject} , #{createTime} , #{updateTime})")
    void queryPostClazz(Clazz clazz);

//    @Select("select * from clazz where id = #{id}")
    Clazz queryClazz(Integer id);


    void updateClazz(Clazz clazz);


}
